<template>
	<view>
		<!-- 修改密码 -->
		<view class="changepay">修改支付密码</view>
		<!-- 输入支付密码 -->
		<view class="enterpassword">请输入新支付密码</view>
		<one-input @finish="finishedOne" type="box" :maxlength="6" class="input" color="#333333"></one-input>
		<view class="button center f30 cfff" v-if="payPassword.length > 5 || oldPayPassword > 5" @tap="updatePayPassword()">完成</view>
	</view>
</template>

<script>
import oneInput from '../../components/myp-one/myp-one.vue';
import md5 from '../../common/md5.min.js';
export default {
	data() {
		return {
			payPassword: '',
			oldPayPassword: ''
		};
	},
	components: {
		oneInput
	},
	onLoad(e) {
		this.oldPayPassword = e.oldPayPassword;
	},
	methods: {
		finishedOne(e) {
			this.payPassword = e;
		},
		updatePayPassword() {
			let parems = {
				oldPayPassword: md5(this.oldPayPassword),
				payPassword: md5(this.payPassword)
			};
			this.$ajax(this.apiList.updatePayPassword, parems).then(res => {
				this.$sToast('修改成功');
				this.$back(2, 1500);
			});
		}
	}
};
</script>

<style>
.input {
	margin-top: 69rpx;
	color: #333333;
}

.changepay {
	color: #666;
	padding-top: 61rpx;
	text-align: center;
	font-size: 60rpx;
}

.enterpassword {
	color: #666;
	padding: 29rpx 0 71rpx;
	text-align: center;
	font-size: 26rpx;
}

.button {
	margin-top: 20rpx;
	width: 616rpx;
	height: 80rpx;
	line-height: 80rpx;
	background: #0297fe;
	border-radius: 4rpx;
	margin: 19rpx auto;
}

page {
	background: #f3f3f3;
}
</style>
